const { defineConfig } = require('@vue/cli-service')
const path = require('path')
module.exports = defineConfig({
  chainWebpack: config => {
    config.plugin('copy').use(require('copy-webpack-plugin'), [
      {
        patterns: [
          {
            from: path.join(__dirname, '/src/template'),
            to: path.join(__dirname, '/dist/template')
          }
        ]
      }
    ])
  },
  transpileDependencies: true,
  devServer: {
    proxy: {
      '/api': {
        target: 'http://www-wms-java.itheima.net/',
        ws: true,
        changeOrigin: true,
        pathRewrite: {
          '^/api': '/api'
        }
      },
      '/ips': {
        target: 'http://www-wms-java.itheima.net/',
        ws: true,
        changeOrigin: true,
        pathRewrite: {
          '^/ips': '/ips'
        }
      }
    }
  }
})
